Artificial intelligence models for methylene blue removal using functionalized carbon nanotubes

This study aims to assess the practicality of utilizing artificial intelligence (AI) to replicate the adsorption capability of functionalized carbon nanotubes (CNTs) in the context of methylene blue (MB) removal. The process of generating the carbon nanotubes involved the pyrolysis of acetylene under conditions that were determined to be optimal. These conditions included a reaction temperature of 550 °C, a reaction time of 37.3 min, and a gas ratio (H2/C2H2) of 1.0. The experimental data pertaining to MB adsorption on CNTs was found to be extremely well-suited to the Pseudo-second-order model, as evidenced by an R2 value of 0.998, an X2 value of 5.75, a qe value of 163.93 (mg/g), and a K2 value of 6.34 × 10–4 (g/mg min).The MB adsorption system exhibited the best agreement with the Langmuir model, yielding an R2 of 0.989, RL value of 0.031, qm value of 250.0 mg/g. The results of AI modelling demonstrated a remarkable performance using a recurrent neural network, achieving with the highest correlation coefficient of R2 = 0.9471. Additionally, the feed-forward neural network yielded a correlation coefficient of R2 = 0.9658. The modeling results hold promise for accurately predicting the adsorption capacity of CNTs, which can potentially enhance their efficiency in removing methylene blue from wastewater.


Batch adsorption experiments
In order to ascertain the adsorption propensity of carbon nanotubes (CNTs) in the context of eliminating Methylene blue (MB) from water, a series of mass adsorption experiments were carried out.Three investigations were carried out, including batch tests with MB pollutants, kinetic studies, and isotherm studies.MB concentrations were measured at 665 nm utilizing a UV-visible spectrophotometer.The adsorption experiments were performed in 250 mL Erlenmeyer flasks with glass stoppers.The required amount of adsorbate (MB) was dissolved in a 1000 mL volumetric flask, and deionized water was added to reach the mark, producing the stock solution of the adsorbate (MB).Batch adsorption tests were conducted on the carbon nanotubes (CNTs).Each adsorbent was added at a fixed dose of 10 mg per 50 mL of contaminant (50 mg/L).The mixture was stirred at a constant speed of 180 rpm for 120 min at room temperature, maintaining a pH of 6.0.After the period of adsorption, a specified quantity of the solution was extracted and subjected to centrifugation at a rate of 4000 revolutions per minute for a duration of 10 min.The content of the sorbate in the resulting liquid above the sediment was estimated by observing the wavelength at which the absorbance reached its maximum using a spectrophotometer that operates in the ultraviolet-visible range.Following this, the efficiency of removal was determined by utilizing Equation to calculate the percentage (1).www.nature.com/scientificreports/whereas q e (mg/g), Using Equation, the equilibrium contact time adsorbate concentration was calculated 2.
where C o , C t , and C e (mg/L) represent the initial liquid-phase adsorbate concentration, adsorbate concentration at time t (min), and adsorbate concentration at equilibrium time, respectively.While V is presenting the volume of the solution.(in liters), w is presenting the mas for adsorbent, (in grams).Table 2 provides a list of the adsorption parameters.The empirical observations were conformed to various isotherm frameworks, such as Langmuir, Freundlich, and Temkin, in order to ascertain the process of adsorption.The initial concentration of MB employed in the kinetic assessments was 50 mg/L, and this value was consistently upheld throughout the entirety of the investigations.Kinetic modeling was employed to predict the appropriate rate expressions for reaction mechanisms and estimate the rate of contaminant removal from aqueous effluents through sorption.Similar to batch equilibrium studies, kinetic parameters were evaluated, and different contact times were employed to assess the applicability of the investigated kinetic models 18 .The optimal kinetic models that best matched the experimental data were selected based on error functions, including the nonlinear chi-square (X 2 ) and the linear coefficient of determination(R 2 ) 19 .

Artificial intelligence models
The methodology of the proposed study will be based on the application of artificial intelligence (AI) models.This study seeks to assess the efficacy of AI models through the comparison of the results obtained from two fundamental models, specifically the feedforward neural network and the recurrent neural network.The adsorption capacity of functionalized carbon nanotubes in aqueous solutions will be predicted using MATLAB's NN Toolbox R2014a.The independent variables in the experiment are pH, absorbent dosage, and contact time.Artificial neural networks (ANNs) are advanced statistical techniques utilized in this study.The method employed in this research involved creating a logical model consisting of interconnected neurons in a computer network that emulates the functioning of the human nervous system.Neural networks are utilized for tackling complex test models involving tasks such as pattern recognition, classification, and estimation [20][21][22][23] .There are two types of artificial neural networks (ANNs): supervised and unsupervised.Supervised ANNs are used for classification tasks, while unsupervised ANNs are used for regression tasks 24,25 .In the supervised model, the network is educated using annotated data to modify the optimal weight values across neurons, thus enabling it to produce the intended output value(s) upon encountering novel input data.In contrast, the unsupervised model does not     www.nature.com/scientificreports/have a specific target output value when provided with input data.For this study, the supervised technique was employed.To produce multiple data sets for testing and training the ANN model, the prepared data were divided into specific percentages.However, the division was structured such that the majority of the data constituted the training set.The data was then rearranged within the spreadsheet and examined to ensure the absence of any pre-existing combinations of trends or inherent characteristics within the data.In order to analyze layer recurrence and feed-forward backpropagation (BP) in the RNN model, several factors were taken into account, including the number of neurons, layers, testing and training sets, and the choice of transfer function.The connection weights, denoted as WI, link the input to the hidden layer.
For both the RNN and FFNN models, the weights and biases were initialized to zero and then modified iteratively using the stochastic gradient descent (SGD) optimizer, which employed a learning rate of 0.01.

Feedforward neural network
The feedforward neural network (FFNN) is widely recognized as one of the earliest and most influential algorithms in the field of machine learning (ML).It is also known as a multilayer perceptron (MLP) or simply a neural network (NN).The FFNN structure comprises three tiers of neurons: the initial tier, one or more concealed tiers, and the terminal tier.Every neuron in a specific tier is linked to neurons in additional tiers via weighted connections (w).Neurons can be described as mathematical expressions that process information within the network.The input layer receives information in the form of input parameters, which are subsequently passed on to the next layer, called the hidden layer(s).The hidden layer(s) serves as a crucial component in connecting the input and output layers, facilitating the transformation between these two layers.It comprises multiple neurons responsible for carrying out the necessary computations.Each neuron is linked to other neurons through weighted connections, which quantify the strength of the connections.The output layer represents the target of our study, as it is the layer from which we seek to make predictions.The overall process of the FFNN can be summarized as follows: Firstly, each input parameter in the input layer is multiplied by its corresponding weight, and then bias is added to each product obtained in the previous step.This helps adjust the inputs to more practical and meaningful ranges.Subsequently, activation functions are applied to map the features between the input and output layers.Finally, by aggregating the results obtained for each neuron in the previous steps, the desired outputs are achieved.Figure 2 provides a simple illustration of the model structure for the FFNN, showcasing its input and output variables.

Recurrent neural network
This subsection provides a basic overview of recurrent networks without delving into the specifics of the technique.For training, these networks often utilize a form of backpropagation.Many hydrologic systems demonstrate geographical and temporal variability, requiring a dynamic estimation approach.Appropriately selected artificial neural networks can effectively simulate such dynamic interactions.In the simplest scenario, a node computes the cumulative weighted sum of its inputs after being processed by a nonlinear activation function.Figure 3 depicts the model structure of an RNN, including the input and output parameters.
Recurrent backpropagation is a neural network approach that can be employed with networks featuring arbitrary connections 26 .Recurrent back-propagation is briefly described by The technique is briefly outlined by 27 , including its mathematical properties and implementation details.

Performance criteria
Two competing neural networks, FFNN and RNN, were devised for the development of the ANN model in this investigation.Two neural network models, FFNN and RNN, were developed and utilized in this study to construct the ANN model.The variables investigated in the experiment included adsorbent dosage, pH, and contact time.Multiple criteria were evaluated to assess the effectiveness of the FFNN and RNN models.The comparison between actual and simulated data was conducted to determine the performance of each model.The evaluation metrics used for assessing the simulation performance of the models included RE (relative error), MAPE (mean absolute percentage error), RMSE (root mean square error), MSE (mean square error) and RRMSE (relative where one-quarter of the exact value of Da(t) D f (t) is equivalent to the computed value, SSres ¼ represents the sum of squares for regression, while SStot symbolizes the sum of the squares of residuals.RRMSE, MSE, RMSE, MAPE, and RE serve as the metrics utilized to assess the efficacy of the model.Multiple metrics are employed to ascertain the precision of the model.These metrics are derived through the comparison of disparities between the actual and predicted outcomes.

Findings and discussion
This section presents the findings of the study and provides a comprehensive discussion of the results.

FESEM and TEM analyses
This section is dedicated to the analysis of the synthesized CNTs' characterization.The morphology of the synthesized CNTs is depicted in Fig. 1 through the FESEM and TEM images.Upon microscopic analysis, it was found that the synthesized CNTs predominantly consisted of dense CNTs with tubular structures, as seen in Fig. 4a.The TEM image in Fig. 4b revealed CNTs that were well-graphitized and had an outer diameter ranging from 10 to 40 nm.It is noteworthy that these CNTs exhibited a closed tip, which was tilted from the vertical direction and originated from Ni particles.The Ni particles had an average diameter size of 70 nm.The presence of catalytic particle encapsulation at the tip, as shown in Fig. 4c, indicated that the growth of CNTs followed the tip growth mechanism.These observations differ from the findings of previous studies, which resulted in the production of a singular type of CNF 28 .

Adsorption isotherms
As depicted in Fig. 5, the equilibrium adsorption data were assessed using the Langmuir, Freundlich, and Temkin models, as denoted by (a), (b), and (c) respectively.Table 3 illustrates the linearized equations and associated parameters for these models.Within the experimental conditions, the Freundlich isotherm indicates a favorable adsorption of MB onto CNT, as suggested by the values of the Freundlich constants (RL = 0.031 and n = 2.8).Conversely, the Langmuir isotherm exhibited the highest correlation coefficient and best fit (R2 = 0.989), with a Adsorbent dosege(g)

Adsorption kinetics
The data obtained from the experiment were subjected to fitting procedures according to different kinetic equations.The distinctive parameters of each of these models, including the linear coefficient of determination (R2) and non-linear Chi-square (X2), were consolidated and presented in Table 4.The illustrations of the analyzed dynamic models can be observed in Fig. 6.A considerable R2 value and a diminutive X2 value signify a commendable concordance between the dynamic model and the empirical information 28 .As stipulated in Table 4, the pseudo-second-order kinetic model offers the most proficient elucidation for the adsorption of MB onto CNT, as it showcases the utmost correlation coefficient.This is supported by the smallest R2 and X2 values (0.988 and 5.75, respectively) compared to other models.Therefore, the MB adsorption onto the CNT adsorbent follows the pseudo-second-order kinetics model, which precisely describes the system's behavior.This observation is consistent with previous findings on the MB adsorption kinetics of carbon dioxide adsorbents 17,29,30 .The chemical sorption that takes place during the adsorption of MB onto CNT is considered to be the rate-controlling phase, as per the Pseudo-second order model.This sorption involves valence forces that arise from the sharing or exchanging of electrons between the pigment and the adsorbent [31][32][33] .Additionally, Fig. 6c displays a relatively linear graph acquired through the regression analysis of qt against t from the regression analysis of qt versus t0.5, which yields an R 2 value of 0.914.However, the disparity between the line and the origin implies that external mass transfer could potentially play a significant role in the adsorption process, in addition to intraparticle diffusion 28,31 .The observation is supported by the noteworthy intercepts witnessed in the linear segment of the graph (C = 101.79),which signifies a notable involvement of the CNT surface in the removal of MB and emphasizes the significance of diffusion in the boundary layer 33 .A comparison of the utmost adsorption capacity of MB on different adsorbents is exhibited in Table 5.
Carbon nanotubes (CNTs) are considered to be suitable candidates as adsorbents for the pre-concentration and elimination of pollutants from large volumes of wastewater.The comprehensive findings derived from the investigation propose that the primary mechanism of adsorption for both cationic and anionic dyes on carbon nanomaterials (CNMs) is attributed to the interaction of the electron donors (such as highly polarizable graphene Table 4. Linearized equations of investigated kinetic models for MB adsorption on activated carbon nanotubes CNT 31 .

Model Equation Parameters Values
Pseudo-first-order ln q e − q t = lnq e − K 1 t R 2 0.884  www.nature.com/scientificreports/sheets) with the electron acceptors (aromatic molecules) present in carbon nanomaterials.Furthermore, there is a strong occurrence of surface complexation between ions and functional groups that are present on the CNMs, as depicted in Fig. 7. Furthermore, the higher MB adsorption under basic condition may be attributed to the electrostatic attraction between the cationic species of MB with the negatively charged surfaces.The surface charge assessed by the point of zero charge (pH PZC ) is defined as the point where the zeta potential is zero.When pH < pH PZC , the surface charge is positive, and when pH > pH PZC , the surface charge is negative.In this case, the pH PZC of CNTs determined by the pH drift method is about 8.0 (see Fig. 8).

FFNN modeling and performance
The data was modeled using artificial neural networks.The performance of each model was assessed using indicators such as RRMSE, MSE, MAPE, RMSE, and RE%.These indicators were compared among the models, and the one with the lowest values was considered the optimal model.During the process of data validation, the number of neurons in the concealed layer was altered within the range of 3 to 12.The most effective number of neurons was ascertained by evaluating the minimal values of RRMSE, MSE, MAPE, RMSE, and RE%, in conjunction with the maximal value of R2.The outcomes of this particular selection process can be observed within Tables 6 and 7.The MSE value was observed to be 1081.72 for 3 neurons in the hidden layer.However, the MSE increased to 1382.90 when 4 neurons were utilized.Interestingly, the application of 5 hidden neurons resulted in a significant decrease in the MSE to 14.54, indicating a more stable network.This trend is illustrated in Fig. 9R1.Subsequently, with the implementation of 6 hidden neurons, the MSE value sharply increased to 703.93.For 7 neurons, the MSE decreased to 32.86, but it significantly increased to 343.84 with 8 neurons in the hidden layer.However, when 9 neurons were employed, the MSE decreased to 87.61.Finally, with the application of 10, 11, and 12 hidden neurons, the MSE values displayed a gradual increment to 271.53, 439.38, and 755.14, respectively.The MSE value was found to be 647.05 for 3 neurons in the hidden layer.However, the MSE decreased to 597.58 when 4 neurons were utilized.With the application of 5 hidden neurons, the MSE increased to 609.55.Interestingly, the implementation of 6 hidden neurons resulted in a lower MSE value of 454.60, indicating a more stable network.This is depicted in Fig. 9R2.However, when 7 and 8 hidden neurons were used, the MSE values significantly increased to 3200.20 and 4720.98,respectively.On the other hand, with 9 neurons in the hidden layer, the MSE decreased to 2574.11.Further improvement was observed with 10 neurons, resulting in an MSE of 1414.75, and with 11 neurons, resulting in an MSE of 839.35.However, with the application of 12 hidden neurons, the MSE value increased to 10,770.53.
The scatter plots comparing the FFNN data with the experimental data were based on selecting the model with the minimum MSE value and the maximum correlation coefficient (R 2 ).The model with the lowest MSE value of 14.54 and a high correlation coefficient (R 2 ) of 0.9658 is considered the best model for predicting R1, as depicted in Fig. 10R1.
Similarly, for predicting R 2 , the model with the minimum MSE value of 454.60 and the maximum correlation coefficient (R2) of 0.836 is considered the best model.This model demonstrates a strong correlation between the actual and predicted values, as shown in Fig. 10R2.
Among the indicators used to assess the accuracy of the predicted values by the model, the relative error stands out.By conducting measurements and making comparisons between the anticipated values and the real values, one can assess the calculations in relation to their precision and accuracy.Accuracy denotes the degree to which the projected value corresponds with the actual value, whereas precision pertains to the uniformity of values within the set.The maximum relative error values for R 1 and R 2 can be identified from the results illustrated in Fig. 11.

RNN modeling and performance
The performance indicators were used to evaluate the best RNN models for predicting R1.Among these indicators, RRMSE and MAPE had the highest values of 0.682 and 45.35, respectively, when 3 neurons were used in the hidden layer.On the other hand, the RMSE indicator had the highest value of 39.00 when 8 neurons were ).These results are offered in Table 8.
The RRMSE indicator obtained the largest value of 0.458 when 9 neurons were used in the hidden layer.On the other hand, for the indicators MSE, MAPE, RMSE, and RE%, the highest values were observed when 5 neurons were used: 7873.31,39.54, 88.73, and 100.52, respectively.It is worth noting that all indicators achieved their lowest values with 8 neurons: RRMSE (0.062), MSE (172.08),MAPE (3.850), RMSE (13.11), and RE% (−18.49).These results are presented in Table 9.
The MSE value for the network with 3 neurons was found to be 1051.21.However, when the number of neurons increased to 4, the MSE significantly decreased to 193.06.On the other hand, with the application of 5 hidden neurons, the MSE increased to 955.74.Subsequently, when 6 hidden neurons were used, the MSE decreased to 51.63, as depicted in Fig. 12R1.However, with the application of 7 and 8 hidden neurons, the MSE values increased to 1032.76 and 1521.05,respectively.For 9 hidden neurons, the MSE decreased to 586.399, while for 10 hidden neurons, it was 302.27.Furthermore, with 11 hidden neurons, the MSE decreased to 157.98.However, when 12 hidden neurons were utilized, the MSE increased to 625.33.
The MSE value for the network with 3 neurons was found to be 2438.08.However, when the number of neurons increased to 4, the MSE sharply decreased to 365.43.On the other hand, with the application of 5 hidden neurons, the MSE increased to 7873.31.With the addition of another neuron in the hidden layer (6 neurons), the MSE decreased to 1053.30.However, when 7 hidden neurons were used, the MSE increased to 1271.06.Interestingly, with the application of 8 hidden neurons, the MSE sharply decreased to 172.08, as shown in Fig. 12R2.Furthermore, for 9 hidden neurons, the MSE increased to 5728.90.For 10 hidden neurons, the MSE was 275.67.Gradual increment in the MSE was observed when increasing to 11 hidden neurons (MSE = 1035.15).Finally, with the application of 12 hidden neurons, the result of the MSE increased to 1240.00.
The scatter plots compare the information obtained from the RNN with the experimental data.The best performance in terms of correlation coefficient (R 2 ) was achieved when the network structure had 6 hidden neurons in the hidden layer, resulting in an R 2 value of 0.9002.This model is considered the best for predicting R1, as shown in Fig. 13R1.Similarly, for predicting R 2 , the best performance in terms of correlation coefficient (R 2 ) was observed with 8 neurons in the hidden layer, yielding an R 2 value of 0.9471.This model is considered a better fit for predicting R 2 , as shown in Fig. 13R2.
Based on the results depicted in Fig. 14R1, the maximum error for R1 is found to be less than 43.39%.Similarly, for R2, the maximum error is less than 18.49%, as revealed in Fig. 14R2.The initial experimentation for www.nature.com/scientificreports/FFNN primarily aimed to investigate the number of hidden layer neurons in order to determine the optimal configuration for the network structure.Additionally, it aimed to identify scenarios where the network fails to make accurate predictions.The evaluation metrics MSE and RMSE achieved their lowest values of 14.54 and 3.81, respectively, while obtaining the highest correlation coefficient value of 0.9658 when the hidden layer contained 5 neurons for R1.For R2, the lowest values of MSE and RMSE were observed as 454.60 and 21.32, respectively, along with the best correlation coefficient value of 0.836 when the hidden layer contained 6 neurons.These findings are presented in Table 10.
In summarizing the modeling performance of both FFNN and RNN models, it can be concluded that the model structure significantly impacts their performance.Fluctuations in error can be observed for both R1 and R2, which can be attributed to the complex relationship between input variables and output.The FFNN model demonstrated better performance with a smaller number of neurons in the hidden layer, while the RNN model required a slightly higher number of neurons to achieve optimal performance.Furthermore, it is evident that increasing the number of neurons negatively affected the performance of both models.This can be attributed to overparameterization and the distribution of weight values when using the SGD optimizer.To enhance the

Conclusion
The purpose of this study was to evaluate the efficacy of Feedforward Neural Network (FFNN) and Recurrent Neural Network (RNN) architectures in forecasting Response 1 and Response 2 values.Various performance metrics including RRMSE, MSE, MAPE, RMSE, and RE% were employed to assess the performance of these models.The goal was to minimize these metrics and maximize R 2 values to identify the optimal model.The results indicated that increasing the number of neurons in the hidden layers had a positive impact on the model's performance.This highlights the significance of selecting an appropriate neuron count for achieving accurate predictions.Moreover, the correlation coefficients between the actual data and predictions served as an indicator of the success of each model.Notably, a model with a correlation coefficient of 0.9002 accurately predicted Response 1, while another model with a correlation coefficient of 0.9471 exhibited outstanding performance in forecasting Response 2. The FFNNs also demonstrated strong performance, achieving a high correlation coefficient value of 0.9658 and a low MSE of 14.54.Therefore, based on this study, it can be concluded that both RNNs and FFNNs are highly capable in data prediction applications, particularly for anticipating Responses 1 and 2. Additionally, valuable insights regarding modeling methodologies have been provided.Once the AI models have demonstrated their high accuracy in prediction, it is recommended for future research to explore the potential of utilizing AI models for input optimization.This can involve identifying the best input variables that maximize the value of removal.Furthermore, future research can explore different neural network topologies or incorporate additional features into the analysis to further enhance the predictive performance.

Figure 5 .
Figure 5.The isotherm graphs for MB adsorption on CNTs based on the data presented in the (a), (b), and (c) Langmuir, Freundlich, and Temkin models 29 .

Figure 8 .
Figure 8. Determination of the point of zero charge of the CNTs by the pH drift.

Figure 9 .
Figure 9. Show the correlation between the number of concealed layer neurons and the MSE obtained to predict (R2, R1).

Figure 13 .
Figure 13.The correlation coefficient between observed and predicted values of R1, R2.

Table 1 .
The general characteristics and chemical composition of (Methylene blue) 17

Table 2 .
17mmary for parameters of MB on CNTs17.

Table 3 .
28uations describing the investigated isotherm models for MB adsorption on carbon nanotubes28.

Table 5 .
Comparison of the maximal adsorption capacity (q m ) for MB removal between CNT and other reported adsorbents.

Table 6 .
The performance indicators for FFNN models to predict R1.

Table 7 .
The performance indicators for FFNN models to predict R2.

Table 8 .
The performance indicators for RNN models to prediction of R 1 .

Table 9 .
The performance indicators for RNN models to prediction of R 2 .